<!DOCTYPE html>
<html>
	<head lang="en">
		<meta charset="UTF-8">
		<title>课工场论坛列表</title>
		<link href="../js/bbs.css" rel="stylesheet">
	</head>
	<body>
		<div class="bbs">
			<header><span onclick="newPost(this)">我要发帖</span></header>
			<section>
				<ul id="postList">
					<li>
						<div><img src="../Photo/tou02.jpg"></div>
						<h1>ggggg</h1>
						<p><span>版块：新手报到</span><span>发表时间：2019-11-18 17:28</span></p>
					</li>
					<li>
						<div>
							<img src="../Photo/tou01.jpg">
						</div>
						<h1>ddddd</h1>
						<p><span>版块：新课来了</span><span>发表时间：2019-11-18 17:27</span></p>
					</li>
				</ul>
			</section>

			<div class="post">
				<input class="title" placeholder="请输入标题（1-50个字符）">
				所属版块：<select>
					<option>请选择版块</option>
					<option>电子书籍</option>
					<option>新课来了</option>
					<option>新手报到</option>
					<option>职业规划</option>
				</select>
				<textarea class="content"></textarea>
				<input onclick="send()" class="btn" value="发布">
			</div>
		</div>
	</body>
	<script type="text/javascript">
		function newPost(t) {
			var a = t.parentNode.nextElementSibling.nextElementSibling;
			a.style.display = "block";
		}

		function send() {
			var d = document.getElementsByClassName("title")
			var tit = d[0].value;
			var sel = d[0].nextElementSibling.value;
			var aa = d[0].parentNode;
			aa.style.display = "none";
			var d = new Date;

			var d3 = document.getElementById("postList").firstElementChild.cloneNode(true);
			var d4 = document.getElementById("postList").appendChild(d3);
			var d5 = d4.firstChild.nextElementSibling;

			d5.innerHTML = `<img src="../Photo/tou02.jpg">`; //图片
			d5.nextElementSibling.innerHTML = tit; //h1
			d5.nextElementSibling.nextElementSibling.firstChild.innerHTML = "板块：" + sel; //板块
			d5.nextElementSibling.nextElementSibling.lastElementChild.innerHTML =
				"发表时间：" + parseInt(d.getYear() + 1900) + "-" + parseInt(d.getMonth() + 1) + "-" + d.getDate() +
				" " + d.getHours() + ":" + d.getMinutes();
		}
	</script>
</html>
